<script module lang="ts">
    import { defineMeta } from "@storybook/addon-svelte-csf";
    import Watermark from "./Watermark.svelte";
    import { Image } from "../Image";
    import img from "../../assets/logo.svg";
    import img2 from "../../assets/watermark_image.png";
    import { Paragraph } from "../Typography";
    import Space from "../Space/Space.svelte";
    import { Input } from "../Input";
    import { Slider } from "../Slider";

    const { Story } = defineMeta({
        title: "Components/Views/Watermark",
        component: Watermark,
        tags: ["autodocs"],
        argTypes: {},
        args: {},
    });

    let fontSize = $state(14);
</script>

<Story name="Default">
    {#snippet template(args)}
        <div style="height: 426px">
            <Watermark content="CUI-Svelte">
                <div style="width: 100%; height: 400px"></div>
            </Watermark>
        </div>
    {/snippet}
</Story>

<Story name="MultiLine">
    {#snippet template(args)}
        <div style="height: 426px">
            <Watermark content={["CUI-Svelte", "Watermark"]}>
                <div style="width: 100%; height: 400px"></div>
            </Watermark>
        </div>
    {/snippet}
</Story>

<Story name="Image">
    {#snippet template(args)}
        <div style="height: 426px">
            <Watermark content={["CUI-Svelte", "Watermark"]} image={img2} width={114} height={32}>
                <div style="width: 100%; height: 400px"></div>
            </Watermark>
        </div>
    {/snippet}
</Story>

<Story name="Props" args={{ content: "CUI-Svelte", rotate: -22, gap: [100, 100] }}>
    {#snippet template(args)}
        <Space>
            <div style="flex: 1">
                <Watermark content={args.content} font={{ fontSize: fontSize }} rotate={args.rotate} gap={args.gap}>
                    <Paragraph>
                        The light-speed iteration of the digital world makes products more complex. However, human consciousness and attention resources are limited. Facing this design contradiction,
                        the pursuit of natural interaction will be the consistent direction of Ant Design.
                    </Paragraph>
                    <Paragraph>
                        Natural user cognition: According to cognitive psychology, about 80% of external information is obtained through visual channels. The most important visual elements in the
                        interface design, including layout, colors, illustrations, icons, etc., should fully absorb the laws of nature, thereby reducing the user's cognitive cost and bringing
                        authentic and smooth feelings. In some scenarios, opportunely adding other sensory channels such as hearing, touch can create a richer and more natural product experience.
                    </Paragraph>
                    <Paragraph>
                        Natural user behavior: In the interaction with the system, the designer should fully understand the relationship between users, system roles, and task objectives, and also
                        contextually organize system functions and services. At the same time, a series of methods such as behavior analysis, artificial intelligence and sensors could be applied to
                        assist users to make effective decisions and reduce extra operations of users, to save users' mental and physical resources and make human-computer interaction more natural.
                    </Paragraph>
                    <Image src="https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ" />
                </Watermark>
            </div>
            <div style="width: 400px; padding: 10px;">
                <Input bind:value={args.content} />
                <Slider bind:value={fontSize} />
                <Slider bind:value={args.rotate} min={-360} max={360} />
                gap:[{args.gap?.[0]},{args.gap?.[1]}]
                <Slider bind:value={args.gap[0]} max={200} />
                <Slider bind:value={args.gap[1]} max={200} />
            </div>
        </Space>
    {/snippet}
</Story>
